<?php

use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\GkyQyh;


?>
<script src="../web/js/jquery.min.js" type="text/javascript"></script>
<div class="gky-qyh-showIamge">
        <?php
        $form = ActiveForm::begin([
                    'action' => ['index'],
                    'method' => 'get',
                    'options' => ['class' => 'input-group'],
                    'fieldConfig' => [
                        'template' => '<div class="col-lg-12">{input}</div>',
                    ]
                ])
        ?>
        <div class="col-md-12">
              <label style="float: left;margin-top: 5px;">请选择企业号：</label>
               <div style="overflow: hidden;">
                <?Php 
                    $gkyqyhs=GkyQyh::find()->all();
                    $listData=ArrayHelper::map($gkyqyhs,'id','qyhname');
                    echo $form->field($model, 'qyhname')->dropDownList(
                                $listData, 
                                
                                [
                                    'onchange' => 'textChange(this)'
                                ]
                                );
                ?>  
               </div>
        </div>
    
        <div   style="background: gray; height:300px; width:300px;margin-top: 50px;padding: 20px">
            <img  id="show" src="http://7xl3vf.com1.z0.glb.clouddn.com/gky.jpg" alt="" width="250x"  height="250x" />
        </div>
      
        
</div>
<script type="text/javascript">
    function textChange(obj){
        var id=obj.value;
        $.ajax({
           url:'index.php?r=gky-qyh/search',
           data:{'id':id},
           type:'post',
           dataType:'json',
           success:function(response){
               $('#show').attr("src",response.path);
           }
        });
    }
</script>

